﻿using System;
using System.Reflection;

using Ninject.Core;

using BlueSky.Web.IoC;

namespace BlueSky.Web.IoC.Ninject
{
    public static class NinjectKernel
    {
        private static IKernel _kernel = null;
        /// <summary>
        /// Gets the kernel.
        /// </summary>
        public static IKernel Kernel
        {
            get { return _kernel; }
        }

        internal static void Initialize(params IModule[] config )
        {
            _kernel = new StandardKernel(config);
        }

        internal static void Inject(object instance)
        {
            _kernel.Inject(instance);
        }

        internal static void Dispose()
        {
            if (_kernel != null)
                _kernel.Dispose();
            _kernel = null;
        }
    }
}
